import 'package:flutter/material.dart';

void main() {
  // 1. 运行应用程序。
  runApp(const MaterialApp(
    home: Main(),
  ));
}

class Main extends StatelessWidget {
  const Main({super.key});

  @override
  Widget build(BuildContext context) {
    return Scaffold(
        appBar: AppBar(
          title: const Text('滚动容器-基础用法'),
          backgroundColor: Colors.purple,
        ),
        body: ListView(
            scrollDirection: Axis.horizontal, //默认是垂直
            shrinkWrap: false,
            //physics: const NeverScrollableScrollPhysics(), //禁止滚动

            addAutomaticKeepAlives: true, //保持状态

            padding: const EdgeInsets.all(20),
            reverse: true, //倒序
            children: [
              Container(
                height: 200,
                width: 200,
                color: Colors.red,
              ),
              Container(
                height: 200,
                width: 200,
                color: Colors.green,
              ),
              Container(
                height: 200,
                width: 200,
                color: Colors.blue,
              ),
              Container(
                height: 200,
                width: 200,
                color: Colors.yellow,
              )
            ]));
  }
}
